// psid_results.do

version 10

//************************************************
// 1-YEAR SAMPLE
//************************************************

clear
set mem 50m
use psid1year
set more off

//------------------------------------------------
//table 1 (1-year sample)
//------------------------------------------------

tabstat loglaborbus [aw=weight], by (entre)
tabstat logfaminc [aw=weight], by (entre)
tabstat logaftertax1_faminc [aw=weight], by (entre)
tabstat logfood [aw=weight], by (entre)

tabstat headage highschool somecollege college graduate black ///
	married famsize headhour homeowner [aw=weight], by (entre)

	
//------------------------------------------------
//table 2 (1-year sample)
//------------------------------------------------
cap erase psid_table2.txt

// OLS logfood on log total family income
reg logfood entre logfaminc age???? black married fam? fam?? year???? ///
    [pw=weight], robust
outreg2 logfaminc entre using psid_table2, cttop(OLS)

// IV logfood on log total family income 
ivreg2 logfood entre (logfaminc = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? [pw=weight], robust
outreg2 logfaminc entre using psid_table2, cttop(IV)

// OLS logfood on log disposable income
reg logfood entre logaftertax1_faminc age???? black married fam? fam?? year???? ///
    [pw=weight], robust
outreg2 logaftertax1_faminc entre using psid_table2, cttop(OLS)

// IV logfood on log disposable income
ivreg2 logfood entre (logaftertax1_faminc = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? [pw=weight], robust
outreg2 logaftertax1_faminc entre using psid_table2, cttop(IV)


//------------------------------------------------
//table 3 (1-year sample)
//------------------------------------------------

// logfood on log total family income
qui ivreg2 logfood entre (logfaminc = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logfaminc])

// logfood on log disposable income
qui ivreg2 logfood entre (logaftertax1_faminc = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])


//------------------------------------------------
//table 4 (1-year sample): alternate specifications
//------------------------------------------------

// logfood on log labor plus business
qui ivreg2 logfood entre (loglaborbus = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[loglaborbus])

// logfood on log disposable w/ hours
cap drop loghours
gen loghours = log(headhour)
qui ivreg2 logfood entre (logaftertax1_faminc = highschool somecollege college graduate) ///
	 loghours age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])

// logfood on log disposable age 25-40
qui ivreg2 logfood entre (logaftertax1_faminc = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? if headage >= 25 & headage <= 40 ///
	[pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])

// logfood on log disposable age 41-55
qui ivreg2 logfood entre (logaftertax1_faminc = highschool somecollege college graduate) ///
	age???? black married fam? fam?? year???? if headage >= 40 ///
	[pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])	


//************************************************
// 3-YEAR SAMPLE
//************************************************
	
clear
set mem 50m
use psid3year, replace
set more off

//------------------------------------------------
//table 1 (3-year sample)	
//------------------------------------------------

tabstat loglaborbus [aw=weight], by (entre)
tabstat logfaminc [aw=weight], by (entre)
tabstat logaftertax1_faminc [aw=weight], by (entre)
tabstat logfood [aw=weight], by (entre)
tabstat headage highschool somecollege college graduate black ///
	married famsize headhour homeowner [aw=weight], by (entre)
	
	
//------------------------------------------------	
//table 2 (3-year sample)
//------------------------------------------------

// log food on log total family income
reg logfood entre logfaminc age???? black married fam? fam?? year???? ///
    [pw=weight], robust
outreg2 logfaminc entre using psid_table2, cttop(OLS)

// log food on log disposable income
reg logfood entre logaftertax1_faminc age???? black married fam? fam?? year???? ///
    [pw=weight], robust
outreg2 logaftertax1_faminc entre using psid_table2, cttop(OLS)


//------------------------------------------------
//table 3 (3-year sample)
//------------------------------------------------

// logfood on log total family income
qui reg logfood entre logfaminc ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logfaminc])

// logfood on log disposable income
qui reg logfood entre logaftertax1_faminc ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])

//------------------------------------------------
// (not included in table) pre-1991 sample
//------------------------------------------------

// logfood on log total family income
qui reg logfood entre logfaminc ///
	age???? black married fam? fam?? year???? [pw=weight] if wave < 1991, robust
nlcom 1-exp(-_b[entre]/_b[logfaminc])
// logfood on log disposable income
qui reg logfood entre logaftertax1_faminc ///
	age???? black married fam? fam?? year???? [pw=weight] if wave < 1991, robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])

//------------------------------------------------
//table 4 (3-year sample): alternate specifications
//------------------------------------------------

// logfood on log labor plus business
qui reg logfood entre loglaborbus ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[loglaborbus])

// logfood on log disposable w/ hours
cap drop loghours
gen loghours = log(headhour)
qui reg logfood entre logaftertax1_faminc loghours ///
	age???? black married fam? fam?? year???? [pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])

// logfood on log disposable age 25-40
qui reg logfood entre logaftertax1_faminc ///
	age???? black married fam? fam?? year???? if headage >= 25 & headage <= 40 ///
	[pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])

// logfood on log disposable age 41-55
qui reg logfood entre logaftertax1_faminc ///
	age???? black married fam? fam?? year???? if headage >= 40 ///
	[pw=weight], robust
nlcom 1-exp(-_b[entre]/_b[logaftertax1_faminc])	



/*****************************************************
 * LIFECYCLE ESTIMATES FROM SECTION 6C
 ****************************************************/
 if 0 { 
clear
set mem 500m
//*****remember to modify so that 65 year olds are included****
use psid1year_65

//self employment rate by age
tabstat entre [aw=weight], by (headage)

tabstat reallaborbus [aw=weight], by (headage)

replace reallaborbus = 1.25 * reallaborbus if entre == 1
tabstat reallaborbus [aw=weight], by (headage)
}

